import { GETLIST, ADDITEM } from '../const.js'
import axios from 'axios'
const getlist = (data) => ({ type: GETLIST, payload: data })
const additem = (data) => ({ type: ADDITEM, payload: data })
const asyncgetlist = () => {
    return async (dispatch) => {
        const res = await axios.get('http://localhost:3001/list');
        dispatch(getlist(res.data.list))
    }
}

export { asyncgetlist, additem }